Skip to content

docs(smartui): fix broken syntax in code snippets across SDK docs - #3264

Merged
Ishavyas9 merged 2 commits into
LambdaTest:stagefrom
chaitanyas-maker:docs/smartui-code-snippet-syntax-fixes
Aug 18, 2026
Merged

docs(smartui): fix broken syntax in code snippets across SDK docs#3264
Ishavyas9 merged 2 commits into
LambdaTest:stagefrom
chaitanyas-maker:docs/smartui-code-snippet-syntax-fixes

Conversation

@chaitanyas-maker

Copy link
Copy Markdown
Contributor

What this fixes

I ran every fenced code block in the SmartUI doc set (1,317 blocks across 103 pages) through the real interpreters — python3 compile, node --check, ruby -c, json.loads — and fixed every block that could not parse. Five defect families came out, each reproduced live.

1. The .smartui.json config sample is invalid JSON (7 SDK pages)

enableJavaScript": true is missing its opening quote in the Cypress, Playwright, Puppeteer, Selenium-JS, Selenium-Ruby, TestCafe and WebdriverIO pages, and visual": true in the Espresso page.

Verified live against the CLI:

# documented config
[smartui] Error: Expected property name or '}' in JSON at position 7

# same config with the quote restored
✔ Screenshots captured successfully
✔ Finalized build

This one blocks onboarding outright — a user pasting the documented config cannot start.

2. Missing opening quote inside code (8 files, Java / JavaScript / Ruby)

smartuiSnapshot(driver, HomePage-Header"), By.id(content"), System.getenv(PROJECT_TOKEN"), new File(path/to/document.pdf"), page.navigate(https://example.com"), Map<String, Object">, and others.

3. Curly quotes in Cypress snippets (12 blocks)

cy.smartuiSnapshot(‘Screenshot Name’, options); fails with SyntaxError: Invalid or unexpected token.

4. JavaScript object literals inside Python blocks (Selenium and Playwright Python SDK)

# documented — SyntaxError, "class" is reserved in Python
options = { ignoreDOM: { class: ["Class-1"] } }

# fixed
options = { "ignoreDOM": { "class": ["Class-1"] } }

The other bare keys (id, xpath, cssSelector) parse but raise NameError at runtime. This also retags 23 fences that were marked ```rb or ```py while containing Python, so highlighting was wrong too.

5. Corrupted operators

async t ="> { should be async t => { (TestCafe), and gem 'lambdatest-selenium-driver', '~"> 1.0' should be '~> 1.0' (Ruby SDK).

Also fixed

  • ffrom playwright.sync_api import ... typo in the Playwright Python quickstart
  • Unclosed let config = { object in selenium-visual-regression.md
  • Python using backticks where a string literal was intended in the Remote executor URL
  • Two missing closing fences (smartui-appium-hooks.md, smartui-cli-env-variables.md) that left <TabItem> markup rendering inside code blocks
  • A Java block tagged ```javascript
  • Broken fence titles of the form title="... to ignore by" ID"

Likely root cause

36bc2ac3 "best practice section update for smartui docs" (10 Nov 2025, 42 files, 8,863 insertions) introduced families 1 and 2; f153c312 "fixes for tabs" introduced family 5. The signature — a dropped opening " combined with a spurious " inserted before > — looks like a bad HTML-entity decode in a bulk automated edit rather than hand-typing. These have been published for over eight months and are live on testmuCom today.

Verification

After this change, every Python, Ruby and JSON config block in the SmartUI doc set parses, and no file has an unbalanced code fence. The remaining JavaScript parse failures are deliberate partial fragments (bare 'LT:Options': { ... } objects and curl commands in js-tagged blocks), not defects.

Suggested follow-up

A CI step that syntax-checks fenced code blocks would stop this recurring. Happy to raise that separately if useful.

Audited all 1,317 fenced code blocks on the SmartUI doc set by running
them through the real interpreters (python3, node --check, ruby -c,
json.loads). Fixes every block that could not parse.

Five defect families, all reproduced live:

1. Missing opening quote in the .smartui.json config sample, in 7 SDK
   pages plus espresso. Verified live: the documented config aborts the
   CLI with "Expected property name or '}' in JSON at position 7"; with
   the quote restored the same config captures a build successfully.

2. Missing opening quote inside code, e.g. smartuiSnapshot(driver,
   HomePage-Header"), By.id(content"), System.getenv(PROJECT_TOKEN"),
   new File(path/to/document.pdf"). Java, JavaScript and Ruby.

3. Curly quotes instead of straight quotes in 12 Cypress snippets,
   which fail with "Invalid or unexpected token".

4. JavaScript object literals inside Python blocks, e.g.
   { ignoreDOM: { class: [...] } }. Bare "class" is a SyntaxError in
   Python; the other bare keys raise NameError. Also retags 23 fences
   that were marked rb or py while containing Python.

5. Corrupted operators: "async t =\"> {" should be "async t => {", and
   gem '~"> 1.0' should be '~> 1.0'.

Also fixes: the "ffrom" typo in the Playwright Python quickstart, an
unclosed config object in selenium-visual-regression, Python backticks
used where a string was intended, two missing closing fences that left
TabItem markup rendering inside code blocks, a Java block tagged as
javascript, and broken fence titles of the form title="... by" ID".

After these changes every Python, Ruby and JSON config block in the
SmartUI doc set parses. The remaining JavaScript parse failures are
deliberate partial fragments (bare object literals and curl commands),
not defects.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197inyHsQ3V3CxPicLLvFJy
Resolves the conflict in docs/smartui-appium-hooks.md. Upstream commit
8913771 closed the same unclosed Python code fence this branch fixed and
additionally corrected driver.execute to driver.execute_script, so the
upstream version is kept in full.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DdZjipHk3bGHmZBvwoTXvi
@Ishavyas9
Ishavyas9 merged commit c52c83a into LambdaTest:stage Aug 18, 2026
Ishavyas9 pushed a commit that referenced this pull request Aug 18, 2026
Second batch from the documentation verification sweep. Where the first PR
(#3264) fixed snippets that could not parse, this one fixes snippets that
parse but are wrong.

Java: org.openqa.selenium.JavaScriptExecutor does not exist - Selenium's
interface is JavascriptExecutor (lower-case s). javac reports "cannot find
symbol" and it breaks three complete copy-pasteable classes. Corrected in
6 SmartUI pages, 22 occurrences. C# IJavaScriptExecutor uses are correct
and were left alone.

Maven pins: lambdatest-java-sdk was pinned at 1.0.2, 1.0.7, 1.0.8 and
1.0.18 across four pages against a current stable of 1.0.23 (verified
against Maven Central metadata). The Appium troubleshooting step told
readers to pin 1.0.2, which does not contain SmartUIAppSnapshot at all and
would break a working setup. All five now pin 1.0.23.

CI YAML: five snippets nested "- run:" as a second list item under
"- name:", so they were not parseable YAML. All five now parse.

Stray trailing double quotes (15 occurrences across 8 CI and PDF pages),
e.g. BUILD_NAME: ...$(Build.SourceVersion)" and - 18". Same corruption
family as the missing-opening-quote defects in #3264.

CLI reference: --projectToken does not exist on upload-pdf (the CLI
rejects it with "unknown option"); replaced with the real --pdfNames and
--markBaseline. NO_PROXY is documented but appears zero times in the CLI
bundle - replaced with the proxy variables the CLI actually reads.
--fetch-results writes <build-id>.json, not results.json.

Every claim here was verified by running the real toolchain: javac against
the resolved SDK jars, the SmartUI CLI itself, and Maven Central metadata.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197inyHsQ3V3CxPicLLvFJy
Ishavyas9 pushed a commit that referenced this pull request Aug 19, 2026
Second batch from the documentation verification sweep. Where the first PR
(#3264) fixed snippets that could not parse, this one fixes snippets that
parse but are wrong.

Java: org.openqa.selenium.JavaScriptExecutor does not exist - Selenium's
interface is JavascriptExecutor (lower-case s). javac reports "cannot find
symbol" and it breaks three complete copy-pasteable classes. Corrected in
6 SmartUI pages, 22 occurrences. C# IJavaScriptExecutor uses are correct
and were left alone.

Maven pins: lambdatest-java-sdk was pinned at 1.0.2, 1.0.7, 1.0.8 and
1.0.18 across four pages against a current stable of 1.0.23 (verified
against Maven Central metadata). The Appium troubleshooting step told
readers to pin 1.0.2, which does not contain SmartUIAppSnapshot at all and
would break a working setup. All five now pin 1.0.23.

CI YAML: five snippets nested "- run:" as a second list item under
"- name:", so they were not parseable YAML. All five now parse.

Stray trailing double quotes (15 occurrences across 8 CI and PDF pages),
e.g. BUILD_NAME: ...$(Build.SourceVersion)" and - 18". Same corruption
family as the missing-opening-quote defects in #3264.

CLI reference: --projectToken does not exist on upload-pdf (the CLI
rejects it with "unknown option"); replaced with the real --pdfNames and
--markBaseline. NO_PROXY is documented but appears zero times in the CLI
bundle - replaced with the proxy variables the CLI actually reads.
--fetch-results writes <build-id>.json, not results.json.

Every claim here was verified by running the real toolchain: javac against
the resolved SDK jars, the SmartUI CLI itself, and Maven Central metadata.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197inyHsQ3V3CxPicLLvFJy
Ishavyas9 pushed a commit that referenced this pull request Aug 19, 2026
Second batch from the documentation verification sweep. Where the first PR
(#3264) fixed snippets that could not parse, this one fixes snippets that
parse but are wrong.

Java: org.openqa.selenium.JavaScriptExecutor does not exist - Selenium's
interface is JavascriptExecutor (lower-case s). javac reports "cannot find
symbol" and it breaks three complete copy-pasteable classes. Corrected in
6 SmartUI pages, 22 occurrences. C# IJavaScriptExecutor uses are correct
and were left alone.

Maven pins: lambdatest-java-sdk was pinned at 1.0.2, 1.0.7, 1.0.8 and
1.0.18 across four pages against a current stable of 1.0.23 (verified
against Maven Central metadata). The Appium troubleshooting step told
readers to pin 1.0.2, which does not contain SmartUIAppSnapshot at all and
would break a working setup. All five now pin 1.0.23.

CI YAML: five snippets nested "- run:" as a second list item under
"- name:", so they were not parseable YAML. All five now parse.

Stray trailing double quotes (15 occurrences across 8 CI and PDF pages),
e.g. BUILD_NAME: ...$(Build.SourceVersion)" and - 18". Same corruption
family as the missing-opening-quote defects in #3264.

CLI reference: --projectToken does not exist on upload-pdf (the CLI
rejects it with "unknown option"); replaced with the real --pdfNames and
--markBaseline. NO_PROXY is documented but appears zero times in the CLI
bundle - replaced with the proxy variables the CLI actually reads.
--fetch-results writes <build-id>.json, not results.json.

Every claim here was verified by running the real toolchain: javac against
the resolved SDK jars, the SmartUI CLI itself, and Maven Central metadata.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197inyHsQ3V3CxPicLLvFJy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants